perm filename TAKL.LSP[TIM,LSP]  blob 
sn#657795 filedate 1982-05-07 generic text, type C, neo UTF8
 
COMMENT ā   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	(defun listn (n)
C00004 ENDMK
Cā;
(defun listn (n)
    (cond
      ((= 0 n)
	nil)
      (t (cons n (listn (1- n))))))
(defun mas (x y z)
    (cond
      ((not (shorterp y x))
	z)
      (t (mas (mas (cdr x)
		   y z)
	      (mas (cdr y)
		   z x)
	      (mas (cdr z)
		   x y)))))
(defun shorterp (x y)
       (and y (or (null x)
		  (shorterp (cdr x)
			    (cdr y)))))
;benchmark is called
;(mas (listn 18) (listn 12) (listn 6))
(include "timer.lsp")
(declare (special 18l 12l 6l))
(setq 18l (listn 18.)
      12l (listn 12.)
      6l (listn 6.))
(timer timit
       (mas 18l 12l 6l))